defmodule DdlSchcemaUtil do
    @moduledoc """
        操作 schema 的接口
    """



    def get_table_by_name(name) do
        get_schema_by_table(name)
        |> Enum.map(&(inspect(hd(&1)) <> "." <> name))
    end

    def get_schema_by_table(table_names) when is_list(table_names) do
        """
        SELECT table_schema FROM information_schema.tables WHERE table_name IN #{PsqlLib.convert_in_list(table_names)}
        """
        |> PsqlDb.query()
    end
    def get_schema_by_table(tale_name) do
        """
        SELECT table_schema FROM information_schema.tables WHERE table_name = '#{tale_name}'
        """
        |> PsqlDb.query()
    end


end
